<template>
  <!-- 顶部导航栏 -->
  <div>
    <van-nav-bar
      title="个人中心"
      style="background-color: #1074ff; color: white"
    />
    <!-- 头像个人信息 -->
    <div class="personal">
      <van-image
        round
        width="5rem"
        height="5rem"
        src="/images/ysj.jpg"
        padding="10px"
      />

      <div class="account">
        <p>{{username}}</p>
        <p>{{phone}}</p>
      </div>
    </div>

    <!-- 内容 -->
    <div class="contentBox">
    <div class="content">
      <!-- 就诊人管管理 -->
      <van-cell center is-link to="/patientmanagement">
        <!-- 使用 title 插槽来自定义标题 -->
        <template #title>
          <div class="titleBox">
            <van-image
              round
              width="2.5rem"
              height="2.5rem"
              src="/images/就诊人管理.png"
            />
            <div class="titleCustom">
              <span class="custom-title">就诊人管理</span>
            </div>
          </div>
        </template>
      </van-cell>
      <!-- 核酸检测预约 -->
      <van-cell center is-link to="/choosepatient">
        <!-- 使用 title 插槽来自定义标题 -->
        <template #title>
          <div class="titleBox">
            <van-image
              round
              width="2.5rem"
              height="2.5rem"
              src="/images/testing.png"
            />
            <div class="titleCustom">
              <span class="custom-title">核酸检测预约</span>
            </div>
          </div>
        </template>
      </van-cell>
      <!-- 新冠疫苗预约 -->
      <van-cell center is-link to="/choosepatient">
        <!-- 使用 title 插槽来自定义标题 -->
        <template #title>
          <div class="titleBox">
            <van-image
              round
              width="2.5rem"
              height="2.5rem"
              src="/images/新冠疫苗预约.png"
            />
            <div class="titleCustom">
              <span class="custom-title">新冠疫苗预约</span>
            </div>
          </div>
        </template>
      </van-cell>
      <!-- 问题反馈 -->
      <van-cell center is-link to="/">
        <!-- 使用 title 插槽来自定义标题 -->
        <template #title>
          <div class="titleBox">
            <van-image
              round
              width="2.5rem"
              height="2.5rem"
              src="/images/问题反馈.png"
            />
            <div class="titleCustom">
              <span class="custom-title">问题反馈</span>
            </div>
          </div>
        </template>
      </van-cell>
    </div>
    <!-- 退出按钮 -->
    <div class="btn">
      <van-button color="#1074ff" type="primary" size="large" round @click="logout">退出登录</van-button>
    </div>
    </div>
    <!-- 底部导航栏 -->
    <div class="tabbar">
      <tabber></tabber>
    </div>
  </div>
</template>

<script>
import Tabber from "../components/Tabber.vue";
export default {
  components: { Tabber },
  data() {
    return {
      data: [],
      username: '',
      phone: ''
    };
  },
  methods: {
    getData() {
      this.axios(url).then((res) => {
        // console.log(res);
        this.data = res.data;
      });
    },
    logout() {
      this.$router.push('/login')
      sessionStorage.removeItem('uid')
    },
    getUserName() {
      let uid = sessionStorage.getItem("uid");
      this.axios
        .get(`${this.$base}user/userinfo?id=${uid}`)
        .then((res) => {
          // console.log(res);
          this.username = res.data.data.username
          this.phone = res.data.data.phone
        })
        .catch((err) => {});
    },
  },
  mounted () {
    this.getUserName();
  },
};
</script>

<style lang="less" scoped>
.contentBox{
  width: 100vw;
  height:70vh;
  background-color:#f8f8f8;
} 
.content {
 /* box-shadow: 2px 2px 10px black; */
  border-radius:10px ;
  overflow: hidden;
  margin:auto ;
  width: 90vw;
  height: 50vh;
  background-color: white;
  position: relative;
  top: -3vh;
  box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2);
}
div /deep/ .van-nav-bar__title {
  color: white;
}
.van-hairline--bottom:after {
  border-bottom-width: 0px;
}
.btn {
  position: absolute;
  bottom: 5rem;
  left: 50%;
  width: 70vw;
  margin-left: -35vw;
  button {
    height: 40px;
  }
}

.personal {
  display: flex;
  background-color: #1074ff;
  color: white;
  height: 20vh;
}
.account {
  width: 50vw;
  height: 20vh;
  padding: 3vh 0;
}
.personal .van-image {
  padding: 3vh 5vw;
}
.titleBox {
  display: flex;
}
.titleCustom {
  display: block;
  height: 3rem;
  display: flex;
  align-items: center;
  margin-left: 3vw;
}
</style>